package restdom.validation.ruleengine.conf;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.springmodules.validation.bean.conf.loader.annotation.handler.ValidationRule;
import org.springmodules.validation.bean.rule.ExpressionValidationRule;

/**
 * Represents a validation rule that uses a Rule Engine.
 * 
 * @author Lorenzo Bragaglia
 */
@Documented
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@ValidationRule
public @interface RuleEngineValidated {

	String bindUri() default "";
	
	String source() default "";

	/**
	 * Returns the error code that represents the error when the validation
	 * fails.
	 */
	String errorCode() default ExpressionValidationRule.DEFAULT_ERROR_CODE;

	/**
	 * Returns the default message that represents the error when the validation
	 * fails.
	 */
	String message() default ExpressionValidationRule.DEFAULT_ERROR_CODE;

	/**
	 * Comma-delimited list of arguments to be attached to the error code.
	 */
	String args() default "";

	/**
	 * An condition expressed in an expression language (e.g. OGNL, Valag) that
	 * determines when this validation rule should be applied.
	 */
	String applyIf() default "";

	/**
	 * A list of context in which this validation rule is applicable. Empty list
	 * means this rule is always applicable regardless the validation context.
	 */
	String[] contexts() default {};
}
